﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Models;
using Models.Collections;

namespace LClient
{
    public partial class frmWorkspaceDetails : Form
    {

        private Workspace workspace;

        public frmWorkspaceDetails()
        {
            InitializeComponent();
            label1.Text = this.Text;
        }

        public frmWorkspaceDetails(Workspace w)
        {
            InitializeComponent();

            if (w != null)
            {
                dtWorkSpaceDate.Value = w.Date;
                txtDescription.Text = w.Description;
                txtNote.Text = w.Notes;
                txtPlace.Text = w.Place;
            }

            workspace = w;

        }

        private void frmWorkspaceDetails_Load(object sender, EventArgs e)
        {
            dgRecordings.DataSource = workspace.Recordings;
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void btnSave_Click(object sender, EventArgs e)
        {
            workspace.Save();
            DialogResult = DialogResult.OK;

            Close();
        }

     
    }
}
